using UnityEditor;

public static class AssetDataMenu
{
    [MenuItem("ExcelTools/CreateAsset/CreateAssetAll")]
    public static void CreateAssetAll()
    {
        CreateIconDataManagerAsset();
        CreateIconNewDataManagerAsset();
        CreateItemDataManagerAsset();
    }


    [MenuItem("ExcelTools/CreateAsset/IconDataManager")]
    public static void CreateIconDataManagerAsset()
    {
        string pathAndFileName = string.Format("{0}/{1}.asset", ExcelTools.ConfigAssetPath, typeof(IconDataManager).Name);

        if (System.IO.File.Exists(pathAndFileName))
        {
            EditorUtility.DisplayDialog("文件己存在", "文件己存在于：" + pathAndFileName, "确定");
            Selection.activeObject = AssetDataManager.Get<IconDataManager>();
        }
        else
        {
            Selection.activeObject = CustomAssetTools.CreateAsset<IconDataManager>(pathAndFileName);
        }
    }


    [MenuItem("ExcelTools/CreateAsset/IconNewDataManager")]
    public static void CreateIconNewDataManagerAsset()
    {
        string pathAndFileName = string.Format("{0}/{1}.asset", ExcelTools.ConfigAssetPath, typeof(IconNewDataManager).Name);

        if (System.IO.File.Exists(pathAndFileName))
        {
            EditorUtility.DisplayDialog("文件己存在", "文件己存在于：" + pathAndFileName, "确定");
            Selection.activeObject = AssetDataManager.Get<IconNewDataManager>();
        }
        else
        {
            Selection.activeObject = CustomAssetTools.CreateAsset<IconNewDataManager>(pathAndFileName);
        }
    }


    [MenuItem("ExcelTools/CreateAsset/ItemDataManager")]
    public static void CreateItemDataManagerAsset()
    {
        string pathAndFileName = string.Format("{0}/{1}.asset", ExcelTools.ConfigAssetPath, typeof(ItemDataManager).Name);

        if (System.IO.File.Exists(pathAndFileName))
        {
            EditorUtility.DisplayDialog("文件己存在", "文件己存在于：" + pathAndFileName, "确定");
            Selection.activeObject = AssetDataManager.Get<ItemDataManager>();
        }
        else
        {
            Selection.activeObject = CustomAssetTools.CreateAsset<ItemDataManager>(pathAndFileName);
        }
    }


}
